﻿Imports System.Windows.Data

''' <summary>
''' 
''' </summary>
''' <remarks></remarks>
Public Class FileSystemConverter
    Implements IValueConverter

    Private Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
        Try
            If parameter = "filename" Then
                Return IO.Path.GetFileName(value)
            End If
            If parameter = "foldername" Then
                Return (New IO.DirectoryInfo(value)).Name
            End If
            Return Nothing
        Catch ex As Exception
            Return Nothing
        End Try
    End Function

    Private Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack
        Throw New NotImplementedException()
    End Function
End Class